/**
 * Copyright (c) 2004-2016 All Rights Reserved.
 */
package com.zbest.zpay.web.controller.activity;

import org.springframework.stereotype.Controller;

import com.zbest.zpay.web.controller.BaseController;

/**
 * 
 *
 * @author czhou3306@gmail.com
 * @version $Id: ActivityStatisticsController.java, v0.1 2016年1月7日 下午3:25:38 czhou3306@gmail.com Exp $
 */
@Controller
public class ActivityStatisticsController extends BaseController {/*

    @Resource
    private ActivityVisitCountRepository activityVisitCountRepository;

    *//**
     * 查询活动分享的统计数据
     * 
     * @param request
     * @param bonusDrawForm
     * @return
     *//*
    @RequestMapping(value = "/activity/statistics/summary", method = RequestMethod.GET)
    @ResponseBody
    public String statisticsSummary(HttpServletRequest request,
                                    @RequestParam(required = false) String beginDate,
                                    @RequestParam(required = false) String endDate) {

        Merchant merchant = (Merchant) request.getSession().getAttribute(ContextField.KEY_MERCHANT);
        Map<String, Object> data = new HashMap<String, Object>();
        data.put(ContextField.KEY_MERCHANT_ID, merchant.getMerchantId());
        data.put(ContextField.KEY_BEGIN_DATE, beginDate);
        data.put(ContextField.KEY_END_DATE, endDate);

        ProcessResult processResult = processService.execute(
            ProcessConstant.PROCESS_ACTIVITY_SUMMARY_STATISTICS, data);

        if (processResult.isSuccess()) {
            return newSuccessResult(processResult.getResultObject());
        } else {
            return newErrorResult(processResult.getCode(), processResult.getCode().getMessage());
        }

    }

    *//**
     * 查询活动分享的统计数据
     * 
     * @param request
     * @param bonusDrawForm
     * @return
     *//*
    @RequestMapping(value = "/activity/statistics/share", method = RequestMethod.GET)
    @ResponseBody
    public String query(HttpServletRequest request, @RequestParam String beginDate,
                        @RequestParam String endDate,
                        @RequestParam(required = false) String activityId) {

        Merchant merchant = (Merchant) request.getSession().getAttribute(ContextField.KEY_MERCHANT);
        Map<String, Object> data = new HashMap<String, Object>();
        data.put(ContextField.KEY_MERCHANT_ID, merchant.getMerchantId());
        data.put(ContextField.KEY_BEGIN_DATE, beginDate);
        data.put(ContextField.KEY_END_DATE, endDate);
        data.put(ContextField.KEY_ACTIVITY_ID, activityId);

        ProcessResult processResult = processService.execute(
            ProcessConstant.PROCESS_ACTIVITY_SHARE_STATISTICS, data);

        if (processResult.isSuccess()) {
            return newSuccessResult(processResult.getResultObject());
        } else {
            return newErrorResult(processResult.getCode(), processResult.getCode().getMessage());
        }

    }

    *//**
     * 查询活动的浏览统计数据
     * 
     * @param request
     * @param bonusDrawForm
     * @return
     *//*
    @RequestMapping(value = "/activity/statistics/browse", method = RequestMethod.GET)
    @ResponseBody
    public String browse(HttpServletRequest request, @RequestParam String beginDate,
                         @RequestParam String endDate,
                         @RequestParam(required = false) String activityId) {

        Merchant merchant = (Merchant) request.getSession().getAttribute(ContextField.KEY_MERCHANT);
        Map<String, Object> data = new HashMap<String, Object>();
        data.put(ContextField.KEY_MERCHANT_ID, merchant.getMerchantId());
        data.put(ContextField.KEY_BEGIN_DATE, beginDate);
        data.put(ContextField.KEY_END_DATE, endDate);
        data.put(ContextField.KEY_ACTIVITY_ID, activityId);

        ProcessResult processResult = processService.execute(
            ProcessConstant.PROCESS_ACTIVITY_BROWSE_STATISTICS, data);

        if (processResult.isSuccess()) {
            return newSuccessResult(processResult.getResultObject());
        } else {
            return newErrorResult(processResult.getCode(), processResult.getCode().getMessage());
        }

    }

    *//**
     * 查询用户地域的统计数据
     * 
     * @param request
     * @param bonusDrawForm
     * @return
     *//*
    @RequestMapping(value = "/activity/statistics/area", method = RequestMethod.GET)
    @ResponseBody
    public String area(HttpServletRequest request, @RequestParam String beginDate,
                       @RequestParam String endDate,
                       @RequestParam(required = false) String activityId) {

        Merchant merchant = (Merchant) request.getSession().getAttribute(ContextField.KEY_MERCHANT);
        Map<String, Object> data = new HashMap<String, Object>();
        data.put(ContextField.KEY_MERCHANT_ID, merchant.getMerchantId());
        data.put(ContextField.KEY_BEGIN_DATE, beginDate);
        data.put(ContextField.KEY_END_DATE, endDate);
        data.put(ContextField.KEY_ACTIVITY_ID, activityId);

        ProcessResult processResult = processService.execute(
            ProcessConstant.PROCESS_ACTIVITY_AREA_STATISTICS, data);

        if (processResult.isSuccess()) {
            return newSuccessResult(processResult.getResultObject());
        } else {
            return newErrorResult(processResult.getCode(), processResult.getCode().getMessage());
        }

    }

    *//**
     * 查询用户使用手机机型的统计数据
     * 
     * @param request
     * @param bonusDrawForm
     * @return
     *//*
    @RequestMapping(value = "/activity/statistics/phone", method = RequestMethod.GET)
    @ResponseBody
    public String phone(HttpServletRequest request, @RequestParam String beginDate,
                        @RequestParam String endDate,
                        @RequestParam(required = false) String activityId) {

        Merchant merchant = (Merchant) request.getSession().getAttribute(ContextField.KEY_MERCHANT);
        Map<String, Object> data = new HashMap<String, Object>();
        data.put(ContextField.KEY_MERCHANT_ID, merchant.getMerchantId());
        data.put(ContextField.KEY_BEGIN_DATE, beginDate);
        data.put(ContextField.KEY_END_DATE, endDate);
        data.put(ContextField.KEY_ACTIVITY_ID, activityId);

        ProcessResult processResult = processService.execute(
            ProcessConstant.PROCESS_ACTIVITY_PHONE_STATISTICS, data);

        if (processResult.isSuccess()) {
            return newSuccessResult(processResult.getResultObject());
        } else {
            return newErrorResult(processResult.getCode(), processResult.getCode().getMessage());
        }

    }

    *//**
     * 查询活动的浏览统计数据
     * 
     * @param request
     * @param bonusDrawForm
     * @return
     *//*
    @RequestMapping(value = "/activity/statistics/ticket", method = RequestMethod.GET)
    @ResponseBody
    public String ticket(HttpServletRequest request, @RequestParam String beginDate,
                         @RequestParam String endDate,
                         @RequestParam(required = false) String activityId) {

        Merchant merchant = (Merchant) request.getSession().getAttribute(ContextField.KEY_MERCHANT);
        Map<String, Object> data = new HashMap<String, Object>();
        data.put(ContextField.KEY_MERCHANT_ID, merchant.getMerchantId());
        data.put(ContextField.KEY_BEGIN_DATE, beginDate);
        data.put(ContextField.KEY_END_DATE, endDate);
        data.put(ContextField.KEY_ACTIVITY_ID, activityId);

        List<ActivityVisitDetailCount> countList = activityVisitCountRepository.getTicketStatics(
            activityId, CoreDateUtils.yyyymmdd(beginDate),
            CoreDateUtils.addDays(CoreDateUtils.yyyymmdd(endDate), 1));

        Map<String, Object> map = new HashMap<String, Object>();
        for (ActivityVisitDetailCount count : countList) {
            map.put(count.getDate(), count.getCount());
        }

        return newSuccessResult(map);

    }

*/}
